<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app"></div>
    <script src="./my-template.js"></script>

    <script>
        let templateStr = `
            <div>
                {{ test1 }}
            </div>
            <h3>释放记录</h3>
            <ul>
                {{ #test.cc.list }}
                <li>
                    时间
                    <span>{{ time }}</span>
                </li>
                <li>
                    幣種
                    <span>{{ coinType }}</span>
                </li>
                <li>
                    類型
                    <span>{{ type }}</span>
                </li>
                <li>
                    數量
                    <span>{{ num }}</span>
                </li>
                {{ /list }}

                {{ test.aa }}

                {{ test.aaa }}
            </ul>
        `
        // 对象        
        let domStr = myTemplate.render(templateStr, {
            test1: '123',
            test: {
                aa: '1123',
                aaa: ['a', 'b', 'c'],
                cc: {
                    list: [
                        {
                            time: '2021-09-03 18:00:00',
                            coinType: 'MSPC',
                            type: '每日釋放',
                            num: '2313.1131'
                        },
                        {
                            time: '2021-09-03 18:00:12',
                            coinType: 'MSPC',
                            type: '每日釋放',
                            num: '2313.1131'
                        },
                    ]
                }
            }
        })

        document.querySelector('#app').innerHTML = domStr

        // 数组

        // 数组对象嵌套
    </script>
</body>
</html>